package com.ryzx.auth.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ryzx.jpa.helper.base.BapBaseEntity;
import com.ryzx.jpa.helper.comment.Comment;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

import java.util.HashSet;
import java.util.Set;

@Getter
@Setter
@Entity
@Inheritance(strategy= InheritanceType.JOINED)
@Comment("岗位表")
@Table(name = "bap_post")
public class BapPost extends BapBaseEntity {
    @Comment("名称")
    @Column(nullable = false, length = 30)
    private String name;
    //岗位级别默认0-9；0为最高
    @Comment("岗位级别")
    @Column(nullable = false)
    private Integer level = 9;

    @JsonIgnore
    @Comment("所属部门")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="dept_id",nullable = false)
    private BapDept bapDept;

    @JsonIgnore
    @ManyToMany(fetch = FetchType.LAZY)
    //Api授权清单
    private Set<BapApiAuth> bapApiAuthSet = new HashSet<>();
    @JsonIgnore
    @ManyToMany(fetch = FetchType.LAZY)
    //数据授权清单
    private Set<BapDataAuth> bapDataAuthSet = new HashSet<>();
    @JsonIgnore
    @ManyToMany(fetch = FetchType.LAZY)
    //菜单授权清单
    private Set<BapMenu> bapMenuSet = new HashSet<>();
}